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

Local script affecting other players?

Asked by 4 years ago

I have a script that is supposed to make certain bricks appear for the player when they touch a brick, it works fine except for the fact that other players can also see it when they're not supposed to.

This is my code:

local CrashBlocks = game.Workspace.crash:GetChildren()

local function onTouch(hit)
    for i, v in pairs(CrashBlocks)do
        v.Transparency = 0
        v.CanCollide = true
    end
    end
game.Workspace.speed1.Touched:Connect(onTouch)


local debounce = false

local sound = game.Workspace.soundeffects.Explosion

game.Workspace.speed1.Touched:Connect(function(hit)

    if not debounce then

        debounce = true

        sound:Play()

        wait(3)

        debounce = false
    end
end)


My understanding of local scripts is that they will only appear on the players client, apologies if I'm missing something super obvious here, I'm really new.

0
Do fireclient() User#34929 0 — 4y
0
If you don't understand , take a look at remote events User#34929 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

try a remote event. make a script where you put the function for when the remote event is called onther script to do what ever you want when the remove event is fired on the the client.

Ad

Answer this question