Could anyone help me with turning this script FE compatible, I need it for a horror game of mine.
local mouse = game.Players.LocalPlayer:GetMouse() function Light() local player = game.Players.LocalPlayer local playerChar = player.Character local playerLight = playerChar.Torso:FindFirstChild("Light") local playerSound = playerChar.Torso:FindFirstChild("Sound") if playerLight then playerSound:Destroy() playerLight:Destroy() else light = Instance.new("SpotLight",playerChar:FindFirstChild("Torso")) light.Name = "Light" light.Range = 16 light.Brightness = 10 light.Shadows = true local play = Instance.new("Sound",playerChar:FindFirstChild("Torso")) play.SoundId = "http://www.roblox.com/asset/?id=198914875" play:Play() end end mouse.KeyDown:connect(function(key) key = key:lower() if key == "f" then - Light() end end)
Thank you.
Hi AgentGalahad,
----------------- Services ---------------------- local players = game:GetService("Players"); local rs = game:GetService("ReplicatedStorage"); local uis = game:GetService("UserInputService"); ----------------- Services ---------------------- ----------------- Initial Variables ---------------------- local player = players.LocalPlayer; local re = rs:WaitForChild("Make Part"); ----------------- Initial Variables ---------------------- function do_it(key, gp) -- Function for UserInputService if key.KeyCode == Enum.KeyCode.Q and not gp then -- Checks if the player pressed Q and if the player was not typing while he/she did so. re:FireServer(); -- Fires the RemoteEvent, which fires the function connected to the RemoteEvent, which is in a ServerScript I will post below. end -- end for if statement end -- end for function. uis.InputBegan:Connect(do_it); -- Connecting the function to the event.
----------------- Variables ---------------------- local rs = game:GetService("ReplicatedStorage"); local re = rs:WaitForChild("Make Part"); ----------------- Variables ---------------------- re.OnServerEvent:Connect(function(plr) -- The function that connects the RemoteEvent .OnServerEvent to this function below. The parameter is the player that activated the event. --------------------- PHYSICAL CHANGES --------------------- local part = Instance.new("Part"); local char = plr.Character or plr.CharacterAdded:Wait(); local torso = char:WaitForChild("HumanoidRootPart"); part.CFrame = torso.CFrame * CFrame.new(0, 7, 0); part.Size = Vector3.new(math.random(5), math.random(5), math.random(5)); part.CanCollide = false; part.BrickColor = BrickColor:random(); part.Shape = Enum.PartType.Ball; part.Material = Enum.Material.Neon; local weld = Instance.new("Weld"); local temp = torso.CFrame; weld.Parent = part; weld.Part0 = torso; weld.Part1 = part; weld.C0 = torso.CFrame:inverse() * temp; weld.C1 = part.CFrame:inverse() * temp; part.Parent = workspace; --------------------- PHYSICAL CHANGES --------------------- end) -- end for anonymous function.
Thanks,
Best regards,
~~ KingLoneCat