Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why FireServer() Not Registering?

When I click on a imagebutton & then use :FireServer(), it doesn't work. Anyone know why?

Local Script:

Four1.MouseButton1Click(function()
	if FFour1.Value > 0 then
	else
		gridpos.Value = "Four1"
		game.ReplicatedStorage.PlaceBloxEvent:FireServer(purchaseid.Value, gridpos.Value)
	end
end)

Script:

local Four1 = script.Parent.One
game.ReplicatedStorage.PlaceBloxEvent.OnServerEvent:connect(function(player, purchaseid, gridpos)
	print(purchaseid)
	print(gridpos)
	if gridpos == "Four1" then
		if purchaseid == 1 then
			game.ReplicatedStorage.Models.RustyPrinter:Clone().Parent=Four1
			
		end
	end
end)

Is this because im using an imagebutton? I tried a Button & an Image Button.

2 comments

1

Is there an error?

0

Nope

1 answer

✓ Accepted answer

The problem is in the local script

Four1.MouseButton1Click(function()
    if FFour1.Value > 0 then
    else
        gridpos.Value = "Four1"
        game.ReplicatedStorage.PlaceBloxEvent:FireServer(purchaseid.Value, gridpos.Value)
    end
end)

You are trying to call the event itself rather than calling :Connect() to establish your event listener

Four1.Activated:Connect(function() -- # use Activated
    if FFour1.Value > 0 then
        return
    else
        gridpos.Value = "Four1"
        game.ReplicatedStorage.PlaceBloxEvent:FireServer(purchaseid.Value, gridpos.Value)
    end
end)

2 comments

0

Yeah, still doesn't work... Weird.

0

Haha opps. I was putting this function after a while true do... Yeah I haven't coded in a while...

This discussion is preserved as it was. New answers, comments, and votes are closed.