Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Sword Script Will Not Damage Players/AI, Wont Even Call The Remote?

Local Script Calling Remote:

Tool.Handle.Touched:Connect(function(hit)
	if Swinging and Equipped then
		local hitParent = hit.Parent
		if hit.Parent:FindFirstChildWhichIsA("Humanoid") and hit.Parent.Name ~= Player.Name then
			Remote:FireServer("R??????o????????????m?????????????a????????n??????????????",hitParent)
		end
	end
end)

Script Handling Remote:

local Tool = script.Parent
local Remote = Tool.Remote

local Damage = 6
local Crit = (Damage*2)

function getCrit()
	local Ran = math.random(1,12)
	local Ran2 = math.random(1,12)
	if Ran == Ran2 then
		return true
	else
		return false
	end
end

function damage(Hit)
	local Humanoid = Hit:FindFirstChildWhichIsA("Humanoid")
	local IsCrit = getCrit()
	local Dmg = nil
	if IsCrit then
		Dmg = Crit
	else
		Dmg = Damage
	end
	Humanoid:TakeDamage(Dmg)
end

Remote.OnServerEvent:Connect(function(key,Hit)
	if key == "R??????o????????????m?????????????a????????n??????????????" then
		damage(Hit)
	end
end)

1 answer

✓ Accepted answer

It may be that the remote fetches the player for the first variable so instead replace line 29 with

Remote.OnServerEvent:Connect(function(p, key, hit)

2 comments

0

Oh yea i forgot about remotes fetch the player first. :facepalm: thank you it works now!

0

no problem :)

This discussion is preserved as it was. New answers, comments, and votes are closed.