Im not good with outputs, this is the output: 10:14:12.531 - Workspace.Part.WalkSpeed:32: Expected 'end' (to close 'then' at line 6), got
and this is the code:
local debounce = false
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local id = 7549271
game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and ido == id then
plr.Character.Humanoid.WalkSpeed = 40
end
end)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:connect(function(char)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
char.Humanoid.WalkSpeed = 40
human.WalkSpeed = 40
else
human.Walkspeed = 20
wait(1)
debounce = false
script.Parent.Touched:connect(onTouch)
end
end)
end)

1 comment
Yeh thanks but I wanted it only to work if they touch a part, can you do that for me?