So I have a Script that fires a RemoteEvent whenever the player sits on a seat. It looks like this:
local cgpEvent = game.ReplicatedStorage.ChangeGUIPosition
local garage1 = game.Workspace.Garages.Garage1
local seat1 = garage1.LaptopTable1.Seat.Seat
seat1.Touched:Connect(function(plr)
cgpEvent:FireClient(plr, 1)
end)
Then the LocalScript that receives the signal:
local guiEvent = game.ReplicatedStorage.ChangeGUIPosition
local seatTouched = false
local owns
if script.Parent.Parent.Name ~= "StarterGui" then
owns = script.Parent.Parent.Parent.Value -- The Value is called 'Value'
end
guiEvent.OnClientEvent:connect(function(plr, seat)
if seat == 1 and owns.Value == 1 then
playerGui = script.Parent
seatTouched = true
playerGui.Hint:TweenPosition(UDim2.new(0.5, 0, 0.8, 0))
playerGui.Hint2:TweenPosition(UDim2.new(0.5, 0, 0.85, 0))
if seatTouched == true then
wait(5)
seatTouched = false
end
if seatTouched == false then
playerGui.Hint:TweenPosition(UDim2.new(0.5, 0, 1.1, 0))
playerGui.Hint2:TweenPosition(UDim2.new(0.5, 0, 1.15, 0))
end
end
end)
The problem is, the function doesn't work. It should give you a pop-up with a hint that you can press 'E' to open the menu, and it doesn't.
I tried putting 'print()' in the event in Script and it worked, but when I put the print() inside of the LocalScript' function it won't show up. It's probably because it's a LocalScript. I'll mark your answer as the answer if my problem is solved!

3 comments
What are you trying to do in both 'if's of 'seatTouched' ?
not really important
line 10: put seat.Value instead of seat and secondly, you shouldn't use .Touched as it isn't effecient. You should use this: seat1.ChildAdded:connect(function(child) if child:IsA("Weld") == true then cgpEvent:FireClient(plr, 1) end end) <- the seat creates a weld between the player and the seat when you sit down which totally helps in scripts like these.