I'm doing a script in ServerScriptService that detects if your number of deaths is 0 so it fires the event while if the number is higher than 0 then it doesn't fire the event. I don't even get an error from the workspace and it doesn't even work when I touch the brick. It's a touched event by the way sorry for not informing you about that. Anyways here's the script.
Thanks.
local ts = game:GetService("TweenService")
local part = script.Parent
part.Touched:Connect(function(char)
local leaderstats = char:FindFirstChild("leaderstats")
if leaderstats then
if leaderstats.Deaths.Value == 0 then
local Info = TweenInfo.new(
0.76,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local props = {
Size = Vector3.new(40, 0.5, 33)
}
local overall = ts:Create(part,Info,props)
overall:Play()
elseif leaderstats.Deaths.Value > 0 then
return
end
end
end)

2 comments
first of all, part.Touched returns a part, second, parts probably don't have leaderstats
ok thanks but how can i fix because when i use a player added event it also doesnt work because i tried it.