diff --git a/.gitignore b/.gitignore index d598ebe..244a196 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ /release.rbxm /roblox.yml /moonwave.toml -build/ \ No newline at end of file +build/ +/sourcemap.json \ No newline at end of file diff --git a/lib/init.lua b/lib/init.lua index 4496be4..f779edf 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -344,8 +344,6 @@ function ClientCaster:Start() local ReplicationConn = self._ReplicationConnection if ReplicationConn then ReplicationConn:Start() - else - warn("No replication connection found") end ClientCast.InitiatedCasters[self] = {} diff --git a/testing.project.json b/testing.project.json index a4a2924..43fa254 100644 --- a/testing.project.json +++ b/testing.project.json @@ -1,6 +1,7 @@ { "name": "[ClientCast] testing", "tree": { + "$className": "DataModel", "ReplicatedStorage": { "$className": "ReplicatedStorage", "ClientCast": { @@ -9,9 +10,7 @@ }, "ServerScriptService": { "$className": "ServerScriptService", - "Server": { - "$path": "testing" - } + "$path": "testing" } } } \ No newline at end of file diff --git a/testing/Testing.server.lua b/testing/Testing.server.lua index 443c1d5..6b14eed 100644 --- a/testing/Testing.server.lua +++ b/testing/Testing.server.lua @@ -1,5 +1,38 @@ local ReplicatedStorage = game:GetService("ReplicatedStorage") +local Players = game:GetService("Players") -local ClientCast = require(ReplicatedStorage.hello_world) +local TestingPlayer = Players:GetPlayers()[1] or Players.PlayerAdded:Wait() -print(ClientCast) \ No newline at end of file +local ClientCast = require(ReplicatedStorage.ClientCast) + +local KillPart = Instance.new("Part") +KillPart.Anchored = true +KillPart.CanCollide = false +KillPart.CFrame = CFrame.new(0, 1, 0) +KillPart.Parent = workspace + +local function GenerateAttachment(Position) + local Attachment = Instance.new("Attachment") + Attachment.Name = "DmgPoint" + Attachment.Position = Position + Attachment.Parent = KillPart +end + +for X = -2, 2 do + GenerateAttachment(Vector3.new(X, 0, 0)) +end + +local ClientCaster = ClientCast.new(KillPart, RaycastParams.new(), TestingPlayer) +local Debounce = {} +ClientCaster.HumanoidCollided:Connect(function(_, HitHumanoid) + if Debounce[HitHumanoid] then + return + end + Debounce[HitHumanoid] = true + print("Ow!") + HitHumanoid:TakeDamage(10) + + wait(0.5) + Debounce[HitHumanoid] = false +end) +ClientCaster:Start() \ No newline at end of file