hi again, so i wann make a shop that will open if touching a part, but its bugged like its spamming trigger and argument become nil because no reason
here is the explorer

her is the script inside the part
script.Parent.Touched:Connect(function(part)
if istouching == false then
local character = part.Parent
local player = game.Players:GetPlayerFromCharacter(part.Parent)
print(player)
player.PlayerGui.shop.LocalScript.turnonshop:FireClient(player)
print("enter")
task.wait(0.6)
istouching = true
end
end)
script.Parent.TouchEnded:Connect(function(part)
if istouching == true then
local character = part.Parent
local player = game.Players:GetPlayerFromCharacter(part.Parent)
player.PlayerGui.shop.LocalScript.turnoffshop:FireClient(player)
print("leave")
task.wait(0.5)
istouching = false
end
end)
here is the script inside shop gui
local frame : Frame = script.Parent.Frame
frame.Visible = true
frame.Position = UDim2.new(0.122, 0, 0.988, 0)
frame.Size = UDim2.new(0, 0, 0, 0)
frame:TweenSizeAndPosition(UDim2.new(0, 809, 0, 491), UDim2.new(0.123, 0, 0.022, 0), nil, nil, 0.5)
end)
script.turnoffshop.OnClientEvent:Connect(function()
local frame : Frame = script.Parent.Frame
frame:TweenSizeAndPosition(UDim2.new(0, 0, 0, 0), UDim2.new(0.122, 0, 0.988, 0), nil, nil, 0.5)
task.wait(0.5)
frame.Visible = false
end)