What do you want to achieve?
when a player presses a part button (not a gui!) it will show everyone in the server a textlabel
What is the issue?
ma script dont work
What solutions have you tried so far?
i have looked at many forums in the devfourms and it still dosent work i have tryed to use remote event but am not good at it so it still dosent work
My local script
local repliatcedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RemoteEvent = repliatcedStorage.RemoteEvent
local Gui = script.Parent.TextLabel
local Button = workspace.Game.HallWay1.Office1.LockDown.BaseButton.StartLD
local StopButton = workspace.Game.HallWay1.Office1.LockDown.BaseButton.EndLD
local function PressedButton()
Gui.Visible = true
wait(3)
Gui.Visible = false
end
Button.ClickDetector.MouseClick:Connect(function()
RemoteEvent.OnClientEvent:Connect(PressedButton)
end)
My server script
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local player = game:GetService("Players")
local Button = workspace.Game.HallWay1.Office1.LockDown.BaseButton.StartLD
local function ShowMessage(player)
RemoteEvent:FireAllClients()
end
player.PlayerAdded:Connect(ShowMessage)
-- ServerScript
-- you don't need 'Players'
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local Button = workspace.Game.HallWay1:WaitForChild("Office1").LockDown.BaseButton.StartLD
local StopButton = workspace.Game.HallWay1.Office1.LockDown.BaseButton.EndLD
local function ShowMessage() -- you don't need player for :FireAllClients()
RemoteEvent:FireAllClients()
end
player.PlayerAdded:Connect(ShowMessage)
Button.ClickDetector.MouseClick:Connect(ShowMessage) -- click on the server instead
-- LocalScript
local repliatcedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local RemoteEvent = repliatcedStorage.RemoteEvent
local Gui = script.Parent.TextLabel
local function PressedButton()
Gui.Visible = true
wait(3)
Gui.Visible = false
end
-- you'll only need to listen to the RemoteEvent
RemoteEvent.OnClientEvent:Connect(PressedButton)