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

How would i go about making a part give points on touch of another part?

Asked by
Fxicity 10
3 years ago
Edited 3 years ago

In my case, you push a part onto a part then when it's touched the part you get points every, lets say, 0.2 seconds. However, i'm not sure this is possible due to it saying you cant fire an event because its not client side or something. Answers appreciated, Fxi.

1 answer

Log in to vote
0
Answered by 3 years ago
-- [[Server Side]] --

game.Players.PlayerAdded:Connect(function(plr)
    local ls = Instance.new("Model")
    ls.Name = "leaderstats"
    ls.Parent = plr

    local m = Instance.new("IntValue", ls)
    m.Name = "Points"
    m.Value = 0
end)

--[[Server Side]] --

-- Make sure to put this inside a brick named TouchMe

local TouchMe = script.Parent

TouchMe.TouchMe.Touched:Connect(function(hit)

    local Points = game.Players:FindFirstChild(hit.Parent.Name):WaitForChild("leaderstats").Points

    Points.Value = Points.Value + 1

    wait(2)
end)


Ad

Answer this question