Remote Event Fires Without Me Clicking a UI [SOLVED]

the remote event just fire without me clicking the button Btw I Repost this because i was shy

script

local player = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami


game.Workspace.Tsunami.Tweener7.Disabled = false
print("it works")



player.OnServerEvent:Connect(tsunami)

the print(it works) works but the remote event fires without me clicking the button
btw no errors.
videos:
robloxapp-20220205-2257424.wmv (3.6 MB)

local script:

local remote = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami

script.Parent.Activated:Connect(function()
	remote:FireServer(tsunami)
end)

it needs to spawn the tsunami if i click the button but it doesn’t work
any help will work Btw Play My Game:Coin Mining Simulator - Roblox

1 Like

btw reply with the script because if you don’t i will not know where to put the script

local player = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami
local tweener = tsunami.Tweener7

local function tsunamiFunction(aplayer)
	tweener.Disabled = false
	print("it works")
end

player.OnServerEvent:Connect(tsunamiFunction)

it still fires without me pressing the button btw you didn’t tell me where to put it

I’m just going to let someone else assist you.

1 Like

forummer did the job but i think the problem is at the local side. so maybe give us peek at the local script?

here:

local player = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami
local tweener = tsunami.Tweener7

local function tsunamiFunction(player)
	tweener.Disabled = false
	print("it works")
end

player.OnServerEvent:Connect(tsunamiFunction)

instead of

script.Parent.Activated:Connect(function()
    remoteEvent:FireServer(tsunami)
)

do:

script.Parent.MouseButton1Down:Connect(function()
    remoteEvent:FireServer(tsunami)
)

this should do.

still fires without me pressing the button

1 Like

There might be other script that run the function so you think the script your editing runned the function. Check your scripts at explorer by searching script.

1 Like

hmm ok i will ask a few questions.
1- does your script consist of only the things you’ve shown us?
2- is there any other local script that is running also?

1 Like

Also in here that might be causing the problem. You didn’t toggle the script disabled to true

For the server script:

local player = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami


function run()
  game.Workspace.Tsunami.Tweener7.Disabled = false
print("it works")
end


player.OnServerEvent:Connect(run)

Localscript:

local remote = game.ReplicatedStorage.Events.Tsunami
local tsunami = game.Workspace.Tsunami

if not script.Parent:IsA("TextButton") then print('Im not a text button, please change this') return; -- just some debugging incase its  not a button

script.Parent.MouseButton1Click:Connect(function()
	remote:FireServer(tsunami)
end)

Notify me if it doesn’t work.

1 Like

the script is not disabled screenshot:

Unfortunately, forrumer already answer this + the MouseButton1Click function won’t be shown in function choices if it’s not a button.

Toggle the script to disabled = true

1 Like

A few flaws here:

  • The button may be an ImageButton, if that’s the case it won’t work correctly. :grimacing:
  • Using MouseButton1Down is more compatible on mobile. (From what I’ve heard!)

Other than that, you’re fine! Just thought I’d point that out. :slightly_smiling_face:

but MouseButton1Down works for me every single time?

It’s more compatible on mobile and computer! :slightly_smiling_face:

@happycrazy197_10 we haven’t heard from you, was your problem fixed? If so, press the solution so others with this problem can fix it!