i want dummy to give exp but it doesnt do anything
local PlayersService = game:GetService("Players") local function onTouch(hit) local player = PlayersService:GetPlayerFromCharacter(hit.Parent) local expPoints = player:findFirstChild("leaderstats") if expPoints ~= nil then local points = expPoints:findFirstChild("Exp") if points ~= nil then points.Value = points.Value + 5 end end end script.Parent.Touched:connect(onTouch)
scrypt analysis is clear
I believe you should not have the two if statements.
local PlayersService = game:GetService("Players") local function onTouch(hit) local player = PlayersService:GetPlayerFromCharacter(hit.Parent) local expPoints = player:findFirstChild("leaderstats") local points = expPoints:findFirstChild("Exp") points.Value = points.Value + 5 end script.Parent.Touched:connect(onTouch)
The answer will be in 40min
I'm answering other questions.