Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script is working but another players cant see the damage?

Asked by 5 years ago

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.

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. JakyeRU 637 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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.

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 ? aSpecialGuy 18 — 5y
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. aSpecialGuy 18 — 5y
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. Ashley_Phantom 372 — 5y
0
Reee, I'm* Ashley_Phantom 372 — 5y
View all comments (2 more)
0
Having to watch annoying kids on youtube because you don't understand wiki pages might be a sign that you need some jesus. Ashley_Phantom 372 — 5y
Ad

Answer this question