✓ Accepted answer
Hey there,
First off it's important to keep in mind that if you have multiple parts that can be touched this won't work. You should add an onTouched script into the part itsself if this is the case.
Second off, you can't make a gui visible from the server, you should try to clone the gui into the playerGui. This, in turn, is something you can do with the GetPlayerFromCharacter() command. In the end your script should look something like this (although you may need to edit it a bit).
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)
If this helped, please accept it as your answer. If it didn't - feel free to ask away! ^^
2 comments
That should work tbh
yeah actually that should work