i made a shop pad(like the simulator), when i step on the pad , the shop show up but when i clicked close
, the shop closed . but when i stepped on the pad again , nothing happen.
here is the pad handler(located in ServerScriptService)(ServerScript)
local pad = workspace.ShopPad
pad.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local ShopMenu = player.PlayerGui:WaitForChild("MiddleGui").ShopMenu
if player then
ShopMenu:TweenPosition(
UDim2.new(0.301, 0,0.349, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
.2,
true
)
end
end
end)
here is the close button(located in StarterGui)(LocalScript)
Seems fine. Do you get any output errors? If not, try adding a print statement right before the tween in, to see if the code ever gets that far. If not, move it “outwards” one if- statement at a time to find out where exactly it goes wrong.
i dont know why its not working when im using local script
here is the script(located in the pad, workspace)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
local ShopMenu = Player.PlayerGui:WaitForChild("MiddleGui").ShopMenu
ShopMenu:TweenPosition(
UDim2.new(0.301, 0,0.349, 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
.2,
true
)
end
end
end)
local tweenUI = game.ReplicatedStorage:WaitForChild("ShopRemote").tweenUI
script.Parent.Touched:Connect(function(hit)
print("touched")-- i test if the Touched is work
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Player then
tweenUI:FireServer(Player)
end
end
end)