When a player touches a part, I want this Shop UI to open and stop their walkspeed.
For some reason, it does this for every player when one person touches the part.
Player 1 (The one pressing the part):
Player 2:
I have tried looking around the dev forum but i haven’t really got anywhere.
hitbox.Touched:Connect(function(hit)
if d == true then
d = false
if hit and hit.Parent:FindFirstChild("Humanoid") then
local plr = hit.Parent
script.Parent.Enabled = true
script.Parent.storeOpen:Play()
event:FireServer(plr) -- prevent walking
end
end
end)
script.Parent.Exit.Activated:Connect(function()
script.Parent["Click SFX"]:Play()
closeGui() -- little animation, then closes the gui.
event2:FireServer(16) -- continue walking
end)
ob1.Touched:Connect(function(hit) -- each of these make it so the shop is able to be reopened.
d = true
end)
ob2.Touched:Connect(function(hit)
d = true
end)
ob3.Touched:Connect(function(hit)
d = true
end)
I should also mention that this is a local script.
The events just lead to a script that change the walkspeed of the player based on which event is fired, but i dont think that that is the problem.
I’m sure I’m just missing something and can’t realize but for some reason i am blanking here. Thank you!