My simulator shop is still not working even after I asked a question they told me to add an ontouched script to add on to my original script but it is not pulling up the GUI when we load in.
Ontouched Script :
local taken = false
script.Parent.Touched:Connect(function(hit) if hit then
if part.Parent:FindFirstChild("Humanoid") then local plr = players:GetPlayerFromCharacter(part.Parent) if taken == false then taken = true game.ReplicatedStorage.Gui:FindFirstChild("Shop"):Clone().Parent = plr.PlayerGui end end end)
Original Script :
game.Workspace.ShopPart.Touched:Connect(function(hit) if hit then script.Parent.Shop.Frame.Visible = true end end)
I see you're using arguments that we'rent defined before. Just like you made the argument of the touched event "hit" and then used "part.Parent". So here would be the script with correct arguments:
local taken = false script.Parent.Touched:Connect(function(hit) if hit then if hit.Parent:FindFirstChild("Humanoid") then if taken == false then taken = true local plr = players:GetPlayerFromCharacter(hit.Parent) game.ReplicatedStorage.Gui:FindFirstChild("Shop"):Clone().Parent = plr.PlayerGui taken = false end end end)
It doesn't work because you are refering to different things.
script.Parent.Touched:Connect(function(hit) if hit then
Here you used hit to find the player.
if part.Parent:FindFirstChild("Humanoid") then local plr = players:GetPlayerFromCharacter(part.Parent) if taken == false then taken = true game.ReplicatedStorage.Gui:FindFirstChild("Shop"):Clone().Parent = plr.PlayerGui end end end)
But then you used part to refer to the player. Th game doesn't know what part is so your script won't work. You should turn part into hit. The rest seems fine.
Well... hello sir, here, I think this can help sir..............
local part = script.Parent part.Touched:Connect(function(hit) local player = GetPlayerFromCharacter(hit.Parent) player.PlayerGui.ScreenGui.frame.Visible = true end)