Simply put; when I try to fire my function through a remote event... it's returns with the error of > attempt to call a string value.
I want to use a system that automatically calls the proper function through a remote event.
game.ReplicatedStorage.ControlEvents.ShowEvent.OnServerEvent:Connect(function(plr,Show,Trigger) Show(Trigger) end)
--//Made By MillerrIAm local Event = game.ReplicatedStorage.ControlEvents.ShowEvent --//Main Script script.Parent.MouseButton1Click:Connect(function() Event:FireServer(script.Parent.Parent.Label.Text,"Intro") end)
Thank you for any help you can give me.
What you sent across to the server is not a function, the Show parameter is the text value of a label, so you should set label equal to the Trigger:
game.ReplicatedStorage.ControlEvents.ShowEvent.OnServerEvent:Connect(function(plr,Show,Trigger) Show = Trigger end)
You can't change a string value like you did, it's that simple.
Edit: Now looking back on it, it was confusing because you didn't provide us with anything to do with functions, so if you wanted your error script to run a function that is of the name of the label's text, you would need a table of functions (in a module script if you know how to use them):
local tableOfFunctions = { ["Show"] = function(thing) --do things with thing end } game.ReplicatedStorage.ControlEvents.ShowEvent.OnServerEvent:Connect(function(plr,Show,Trigger) tableOfFunctions[Show](Trigger) end)
If the function is a LocalScript, then do it like this: Change ur function to function _G.Show()
-- Click LocalScript --//Made By MillerrIAm local Event = game.ReplicatedStorage.ControlEvents.ShowEvent --//Main Script script.Parent.MouseButton1Click:Connect(function() _G.Show("Intro") end) -- function LocalScript function _G.Show(Trigger) -- Your Script end