As the title goes, i am having real trouble with these remote events. I made a script that when the client clicks a gui button, it should spawn a humanoid ontop of a part. Problem is that it fires without me even clicking the button then returns nil value if i click it.
Local script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.Mobilization --the remote event
script.Parent.MouseButton1Click:Connect(remoteEvent:FireServer())
Server sided script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage.Mobilization --the remote event
local model = game.ReplicatedStorage.Dummy --the humanoid
local start = workspace.capital.Position --the part
-- Create a new part
local function Mobilization()
local clone = model:Clone() --spawn humanoid
clone.Parent = game.Workspace --attach humanoid to workspace so its visible
clone:MoveTo(start) --teleports humanoid to thje part
end
remoteEvent.OnServerEvent:Connect(Mobilization)
whole script btw
