Script not work second time fired!

Hello, a function fire first-time function works but this function fired 2nd time not works!!!
like this script what is the fix way?

local Explode = game.ReplicatedStorage.Explode
local gui = script.Parent

gui.Visible = false

gui:TweenPosition(UDim2.new(0.057, 0,-0.433, 0))

Explode.OnServerEvent:Connect(function(Player)
	gui:TweenPosition(UDim2.new(0.057, 0,-0.433, 0))
	warn("WORK SCRİPTT")
	wait(5.5)
	gui.Visible = true
	gui:TweenPosition(UDim2.new(0.057, 0,0.078, 0))

end)



Does the ‘warning’ work once or more?

No warnings in output IDK why?

Dude if this in client or local script should use this

local Explode = game.ReplicatedStorage.Explode
local gui = script.Parent

gui.Visible = false

gui:TweenPosition(UDim2.new(0.057, 0,-0.433, 0))

Explode.OnClientEvent:Connect(function()
	gui:TweenPosition(UDim2.new(0.057, 0,-0.433, 0))
	warn("WORK SCRİPTT")
	wait(5.5)
	gui.Visible = true
	gui:TweenPosition(UDim2.new(0.057, 0,0.078, 0))

end)



instead this

Explode.OnServerEvent:Connect(function(Player)

and dont use player as parameter cuz you are in client so you dont need this but if you are in server you can put first parameter as player

1 Like

How I can fire this on the client function I know I must do it in the server-side script but this time fire client script works the second time!

this how to use remote event in client
Client:

local num = 1 --send informetion to server
game.ReplicatedStorage.Remote:FireServer(num)

now we need to get informetion by client to server
Server:

game.ReplicatedStorage.Remote.OnServerEvent:Connect(function(player,num)--Here First parameter player who sent informetion
   print(player.Name.."Sent This Informetion to server"..num) -- num = 1
   game.ReplicatedStorage.Remote:FireClient(player,num+1) -- sent it back again but in first parameter should put player who you want to server send to him 
end)

Client:

game.ReplicatedStorage.Remote.OnClientEvent:Connect(function(num2)
     print("I get massage from server this "..num2) -- num2 = 2
end)
1 Like