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

[SOLVED!] How do I activate a local script from a server script?

I'm making a magic ability, but I need to activate a local script from a server script for it to work. I tried using :FireClient() but that didn't work.

I also tried using _G. but that didn't work either. Does anybody know a way?

Edit: Heres my code:


The portal script

_G.Portal = false

local rp = game:GetService("ReplicatedStorage") local TweenService = game:GetService("TweenService")

local Meshes = rp.VoidBeam:WaitForChild("Meshes") local Animations = rp.VoidBeam:WaitForChild("Animations") local Remotes = rp.VoidBeam:WaitForChild("Remotes")

Remotes.Void.OnServerEvent:Connect(function(player)

rp.Show:FireClient()

local Character = player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Humrp = Character:WaitForChild("HumanoidRootPart")

local EcksDee = Humanoid:LoadAnimation(Animations.EcksDee)
EcksDee:Play()

local Portal = Meshes:WaitForChild("Portal"):Clone()
Portal.CFrame = Humrp.CFrame * CFrame.new(0,10,-75)
Portal.Orientation = Portal.Orientation + Vector3.new(0,180,0)
Portal.Parent = workspace

local Position = Portal.Position

local b = Instance.new("BodyPosition")
b.position = Position
b.maxForce = Vector3.new(500000000, 500000000, 500000000)
b.Parent = Character.UpperTorso

wait(0.95)

	Humrp.Position = Vector3.new(100,30000,100)
Humrp.Anchored = true

_G.Portal = true


b.Parent = nil

end)


The show gui script

game.ReplicatedStorage.Show.OnClientEvent:Connect(function()

if _G.Portal == true then

	script.Parent.Visible = true
	
	
	
end

end)

6 comments

0

Could you please include a script?

0

Well I got no errors and I looked at stuff and the script is fine.

0

Include a script so we can know what the problem is

0

did you include onfireclient in the local script

0

Do you mean, OnClientEvent:Connect(function(), cause I did that

0

I'm getting an error, it says "Argument 1 missing or nil"

1 answer

I solved it! The problem was that if you want to do FireClient() and OnClientEvent(), you need to list who you want to fire it to

So just do FireClient(player) and it works.

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