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

Make this confusing script server sided easily?

Asked by
NewGPU 36
7 years ago
Edited 7 years ago

I've been trying to make this server sided but I'm unable to do so I've tried for about an hour or two trying to fix this..

local Debounce = false
local MultDiv = 5
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and not Debounce then
        local hum = hit.Parent:WaitForChild("Humanoid")

        game.ReplicatedStorage.ScreenGui:Clone().Parent = game.Localplayer.plr.PlayerGui
        hum:remove()
        Debounce = true
        wait(3)
        print("Scumbag named " + Localplayer.Name + "was removed.")
        Debounce = false
    end
end)

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You can't use LocalPlayer in a server script, do this:

local Debounce = false
local MultDiv = 5
script.Parent.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and not Debounce then
        local hum = hit.Parent:WaitForChild("Humanoid")
        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
        game.ReplicatedStorage.ScreenGui:Clone().Parent = plr.PlayerGui
        hum:remove()
        Debounce = true
        wait(3)
        print("Scumbag named " + plr.Name + "was removed.")
        Debounce = false
    end
end)
Ad
Log in to vote
0
Answered by 7 years ago

Hm, I don't get what you're trying to do here.

I believe you're going to be using a standard script for this code, I don't know why you want to convert it to FilteringEnabled.

And if that's not what you're trying to do here's the definition of Server-Sided script:

Script that runs on the server instead of the client, often used in Roblox to prevent any unauthorized changes made by the client when used in FilteringEnabled.

Answer this question