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

Is Local Scripts OK to use to turn water / lights on and off?

Asked by
RBLXHS 9
6 years ago

Can exploiters get into different things with local script being in my game? I am really unsure. If so, I'd like some help converting these to Remote.

water on

local isOn = false
function on()
    isOn = true
    script.Parent.Value.Value = 0 


end


function off()
    isOn = false
    script.Parent.Value.Value = 1

end

function onClicked()

    if isOn == true then off() else on() end

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)


on()

light on

local isOn = false
function on()
    isOn = true
    script.Parent.Parent.Value.Value = 0 
    script.Parent.Parent.click1.Transparency = 0
    script.Parent.Parent.click2.Transparency = 1
    script.Parent.Sound:Play()
    wait(0.3)
    script.Parent.Sound:Stop()
end


function off()
    isOn = false
    script.Parent.Parent.Value.Value = 1
    script.Parent.Parent.click1.Transparency = 1
    script.Parent.Parent.click2.Transparency = 0
    script.Parent.Sound:Play()
    wait(0.3)
    script.Parent.Sound:Stop()
end

function onClicked()

    if isOn == true then off() else on() end

end

script.Parent.Parent.click.ClickDetector.MouseClick:connect(onClicked)


on()
0
With FE, the effects will only show to the player who interacted. However, if you want everyone to also see the effects then you'll want to use remote events. MooMooThalahlah 421 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Basically, if you don't want exploiters to ruin your game for others, you must have Filtering Enabled on. In which case, the changes you make will only render to you, (or, in the exploiters case, the exploiter is the only one who can see it)

Upon turning on FilteringEnabled, your localscripts will no longer function like normal. The reason for this is that with FE off, exploiters can run localscripts on their client, which is not OK as they can modify things in-game.

To fix this, consider using RemoteEvents to make a normal script make the change. If you're just beginning to script, I recommend practicing more until you make a real game. If you think you're confident, FilteringEnabled might be worth looking in to.

Helpful wiki page for remote events: https://wiki.roblox.com/index.php?title=API:Class/RemoteEvent

0
I appreciate your reply on this. I just enabled FilteringEnabled and the scripts I posted above seem to be working for everyone. For example, I turn off the light, and it turns off on everyones client. I am OK with this and I think this is how it should be. I am hoping that hackers cannot alter this local script easily. I'd love to learn how to turn these simple scripts into RemoteEvents. RBLXHS 9 — 6y
Ad

Answer this question