Im writing a code thats supposed to bind an action when the server tells the client that the game has started, the action will bind properly but not work for some reason.
Server Code:
local RepStor = game:GetService("ReplicatedStorage")
local RemoteEvents = RepStor:WaitForChild("RemoteEvents")
local ActionBinding = RemoteEvents:WaitForChild("ActionBinding")
ActionBinding:FireAllClients()
Client Code:
local RepStor = game:GetService("ReplicatedStorage")
local RemoteEvents = RepStor:WaitForChild("RemoteEvents")
local ActionBinding = RemoteEvents:WaitForChild("ActionBinding")
local function Tackle(actionName, inputState)
print("Clicked")
end
ActionBinding.OnClientEvent:Connect(function()
CAS:BindAction("attack",Tackle,true,Enum.UserInputType.MouseButton1)
end)
The action also shows up in action bindings in the developer console but still doesn’t work.
That doesn’t really help my situation right now. But It seems to work when I use it in a different place, so im gonna try disabling other scripts and see if they’re interfering or something. Thanks for the help though
Alright so I finally figured out the problem, when the game starts all the players are killed so they respawn inside the map. But I guess firing the event to Bind the Action right before they die makes it not work. So I just changed the order and made the event fire once they respawn instead of before they die. Thanks again for all the help and tips though