game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
script.Parent.Parent.StarterGui.ShopMenu.ScrollingFrame.rainbow.MouseButton1Click: Connect(function()
local trail = game.ServerStorage["rainbow"]
local plrTrail = trail:Clone()
plrTrail.Parent = char.HumanoidRootPart
plrTrail.Attachment0 = char.Head.FaceFrontAttachment
plrTrail.Attachment1 = char.Torso.WaistBackAttachment
end)
end)
end)
This is the script, i really don't know how to fix it. I've tried alot of different things. Please help me.
StarterGui
is a replication Service. It is used to transfer the UI content into the Connected User's personal GUI Service, that of which is titled 'PlayerGui
'. Attempting to reach any descendants of said replication service, for input, will not do you any good. To get the desired local input, you must reference the authentic home of the GUI.
This can be done like so:
local Player = game:GetService("Players").LocalPlayer Player.PlayerGui.Gui.MouseButton1Click:Connect(function() print("Hello World!") end)