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

Script is working but another players cant see the damage?

When i attack a dummy another player doesnt see how many damage i did on that dummy, but i can see it. On my screen, the dummy's health is going low when i hit it, but on another players screen, its not going low. Its staying still. And i cant see what another player done too.

local Attack = true


script.Parent.Activated:Connect(function()
wait(0.1)

if Attack == true then		
Attack = false	
local character = script.Parent.Parent
local Humanoid = character:WaitForChild('Humanoid')

repeat
wait()
	until character:FindFirstChild("HumanoidRootPart")
	
local part = Instance.new("Part", game.Workspace)
	part.CanCollide = false
	part.CFrame = character.HumanoidRootPart.CFrame
	part.Size = Vector3.new(7.3, 4 ,3)
	part.Transparency = 0.5

local Weld = Instance.new("Weld", part)
	Weld.Part0 = character.HumanoidRootPart
	Weld.Part1 = part
	Weld.C1 = CFrame.new(0, 1, 2.5)
	Weld.C0 = CFrame.new()

	part.Touched:Connect(function(p)
		
		
	local hum = p.Parent:FindFirstChildOfClass("Humanoid")
   		 if p.Parent.Name == ("Mob") then
			if script.Parent.CanDamage.Value == true then
				
				script.Parent.CanDamage.Value = false
   					hum:TakeDamage(math.random(9,23))
    			wait(0.15)
				script.Parent.CanDamage.Value = true
				
			end

		end
	end)


wait(0.15)
part:Destroy()
wait(0.5)
Attack = true	
	
end

end)

Is it a problem of a LocalScript? When i do this on normal script, i can damage on studio but not in normal game. If i do it on LocalScript, then this problem happening.

1 comment

0

Local changes are not replicated to the server. You have to use RemoteEvents / RemoteFunctions. Depends on if you want to return something back to the client.

1 answer

It's called FilteringEnabled and it prevents most of the client's changes from replicating on to the server, meaning if something changes on the client only, the server will not listen to the client and will not change anything on his side, to go around this as a developer, use remote functions and events as well as server-side handlers to go along with them.

6 comments

0

I Didnt understood much but can you tell what i have to do on this script or can you redo this script and tell me what i have to do then ?

0

And after you done it, i can understand it well because im not english and i dont understand with text sorry :( But in script i can understand it.

0

No, I\m not spoonfeeding, read both of the articles, they not only teach you everything you need to know about the topics but the second one also gives you written Lua examples, the basis is that the client script itself does not cause any damage, but it fires a remote event which the server receives and performs checks whether the client was not lying about the target, etc, then do the damage.

0

Reee, I'm*

0

Having to watch annoying kids on youtube because you don't understand wiki pages might be a sign that you need some jesus.

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