✓ Accepted answer
If you have the glowstick in the ServerStorage, you actually need two scripts and a remote,
Create a remote called 'Glowstick' in ReplicatedStorage
and the glowstick named 'Glowstick' in ServerStorage
LocalScript in starter gear
local remote = game.ReplicatedStorage:WaitForChild('Glowstick')
local uis = game:GetService('UserInputService')
uis.InputBegan:Connect(function(input, typing)
if (input.KeyCode == Enum.KeyCode.A) and (not typing) then
remote:FireServer()
end
end)
Script above basically fires the remote if player clicks button 'A' and is not typing (chat etc.)
The second script in ServerScriptService
local remote = game.ReplicatedStorage:WaitForChild('Glowstick')
remote.OnServerEvent:Connect(function(plr)
local glowstick = game.ServerStorage:FindFirstChild('Glowstick')
local chr = plr.Character
local glow = glowstick:Clone()
local hrp = chr:FindFirstChild('HumanoidRootPart')
glow.Parent = workspace
glow.Position = hrp.Position + hrp.CFrame.LookVector + Vector3.new(1,0,0)
end)
This spawns the glowstick infront of player torso (will fall down if not anchored)
1 comment
You can't access ServerStorage from Client