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

What do I load in this script to make it work in servers?

Asked by 7 years ago
Edited 7 years ago

When I kill the NPC, it gives me EXP in solo test mode, but when I play it with more than 1 player it doesn't give me EXP. Am I suppose to load something?

local debounce = false
local player = game.Players.LocalPlayer

function onTouched(hit)
    if not debounce then
        debounce = true
        if hit.Parent.Name:sub(1,17) == "AFK Noob Lv 1 HP " then
            hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 25
            if hit.Parent.Humanoid.Health == 0 then
                player.leaderstats.EXP.Value = player.leaderstats.EXP.Value + 16
            end
            wait(0.5)
            debounce = false
            elseif hit.Parent.Name:sub(1,4) == "Noob" then
            hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 25
            wait(0.5)
            debounce = false
        end
    end
end

script.Parent.Touched:connect(onTouched)
0
You have to identify each player. GoldenPhysics 474 — 7y
0
Also if I put this in a local script it works GatitosMansion 187 — 7y

Answer this question