I have a LOCAL SCRIPT in a BUTTON. I have another LOCAL SCRIPT in STARTERGUI. I have a EVENT in a FOLDER in RS. I want the LOCAL SCRIPT in the BUTTON ***to activate the ***LOCAL SCRIPT in STARTER GUI! Sorry for making so many things bold, its just because some people aren't understanding what I need fixed. Anyways
Local Script in the Button:
Player = game.Players.LocalPlayer script.Parent.Text=tostring(script.Parent.ItemName.Value)..": Gamepass" script.Parent.MouseButton1Click:connect(function() game.ReplicatedStorage.Events.Trails.CustomTrailEvent:FireServer(script.Parent.Parent.Parent.Parent.Parent.Parent.Name) print("WRWIJF!") end)
Local Script in the StarterGui: (Only the first part of the script.)
game.ReplicatedStorage:WaitForChild("Events").Trails.CustomTrailEvent.OnClientEvent:Connect(function(guiname) local Player = game.Players.LocalPlayer local playerid = Player.UserId local id = 4785126 print(guiname) end)
Local Script in StarterGui got cut off, here is the rest: OnClientEvent:Connect(function(guiname)
I should have explained better last time. Also if I get flagged for this being answered already that makes no scense because it didn't. Thanks!
You are trying to communicate between the same client using a RemoteEvent
, these are only for client to server communication. Rather than using this, use a BindableEvent
instead.
You can read about bindable events here: http://wiki.roblox.com/index.php?title=API:Class/BindableEvent