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

How would I make this appear server side?

I'm making a simple flashlight right now and I was wondering how I could make it appear server-side instead of just client. The code is located in a Local Script in the StarterGui.

local mouse = game.Players.LocalPlayer:GetMouse()
function Toggle()
    local player = game.Players.LocalPlayer
    Local char = player.Character
    local active = char.Head:FindFirstChild("Light")
if active then
    active:Destroy()
script.Parent.Light.Frame.Icon.Image = "rbxassetid://"
else
    local light = Instance.new("PointLight",char:FindFirstChild("Head"))
    ---- blah light setting
    end
end
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "f" then
	Toggle()
end
end)

if there is any issues w/ this code then its probably because I typed it instead of copy and pasting it.

2 comments

0

first erro i see is game.Players.LocalPlayer:GetMouse() replace that with game:GetService("Players").LocalPlayer:GetMouse()

0

second error i see is the key function, that function is patched so replace that with mouse.KeyDown:connect(function(key) if key == tostring("f") then

1 answer

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