Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I Make a gui clone into a players gui when they touch a part??

Asked by 5 years ago
Edited 5 years ago

So i did this

script.Parent.Touched:Connect(function(hit)
    local player = hit.Parent:GetPlayerFromCharacter()
    local gui = game.ServerStorage.ScoreBoard:Clone()
    gui.Parent = player.PlayerGui
end)

and says "GetPlayerFromCharacter is not a valid member of Model" and also i dont want it to clone multiple times

1 answer

Log in to vote
1
Answered by
aazkao 787 Moderation Voter
5 years ago
Edited 5 years ago

You dont invoke the method on the model, you invoke the method on game.players, hit.Parent will be the argument to pass inside the method

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

If you do not want it to be cloned multiple times, search up something called debouncing

0
Doesn't work but I figured it out. Thanks for trying :/ WillBe_Stoped 71 — 5y
0
Edited it, wrote the argument inside the parameter wrong just now aazkao 787 — 5y
0
If the code above works please accept the answer so others will be able to learn from it thanks aazkao 787 — 5y
Ad

Answer this question