I'm trying to use a remote event to make a GUI appear on the screen of somebody who touches a button on the floor and then for it to be removed after a couple of seconds. The remote event itself can be found in ReplicatedStorage along with the receiving Script. None of the Scripts used are Localscripts as when I change the script inside of the button to a Localscript, absolutely nothing will happen - it doesn't even print the user you touched the button.
All help is appreciated.
-- Script inside the block to touch
local part = script.Parent
local debounce = false
local ReplicatedStorage = game:GetService("ReplicatedStorage")
part.Touched:Connect(function(hit)
if debounce == true then return end
debounce = true
print(hit.Parent.Name .. " has touched a part!")
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
game.ReplicatedStorage.ShowGui:FireClient(Player)
if Player and not Player.PlayerGui:FindFirstChild(Gui.Name) then
Player.PlayerGui.MessageGui.Message.Alert.Text = "You Touched Me!"
end
wait(5)
Player.PlayerGui.MessageGui:Destroy()
debounce = false
end)
-- Script inside ReplicatedStorage
local player = game.Players.LocalPlayer
local Gui = game.ReplicatedStorage.MessageGui
game.ReplicatedStorage.ShowGui.OnClientEvent:connect(function(player)
Gui:Clone().Parent = player.PlayerGui
wait(3)
player.PlayerGui.MessageGui:Destroy()
end)

13 comments
'Argument 1 missing or nil' when I remove the Player argument
keep the
Playerand tell me what happensThen when I put it back in, it still won't fire
MessageGui is not a valid member of PlayerGui
Editted the asnwer, change the script I editted to the current one in local script.
MessageGui is not a valid member of PlayerGui, again
I am not sure if I can help you since I do not know the localization. I also do not have a perspective of the game.
At the moment I'm simply trying to get a part to show a GUI for the user who touched it and then for it to disappear after a few seconds but for whatever reason it won't show up at all
I rescripted everything, check my answer again.
How do you get the Localscript into PlayerGui?
https://gyazo.com/a4514fce798574e5cdeb1852666c1066
Ahh StarterGui, that threw me off. Thank you.
No problem!