So I have this script in my game
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
local GamepassID = 194497870
local Multiplier = 2
if MarketplaceService:UserOwnsGamePassAsync(Player.UserID, GamepassID) then
Brightness * Multiplier
end
end)
end)
local cam = workspace.CurrentCamera
local RS = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Flashlight = RS.flashlight
local Clone = Flashlight:Clone()
Clone.Parent = script.Parent
local Brightness = 3
local Keybind = Enum.KeyCode.F
local UIS = game:GetService("UserInputService")
local Toggle = false
local Mouse = game.Players.LocalPlayer:GetMouse()
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(.1, Enum.EasingStyle.Sine)
UIS.InputBegan:Connect(function(Input, p)
if p then return end
if Input.KeyCode == Keybind then
Toggle = not Toggle
end
end)
RunService.RenderStepped:Connect(function()
if Clone then
Clone.Position = cam.CFrame.Position
TS:Create(Clone, TI, {CFrame = CFrame.lookAt(Clone.Position, Mouse.Hit.Position)}):Play()
if Toggle then
TS:Create(Clone.SpotLight, TI, {Brightness = Brightness}):Play()
else
TS:Create(Clone.SpotLight, TI, {Brightness = 0}):Play()
end
end
end)
I want to make a 2x flashlight gamepass, how do I make that? My best guess is
local cam = workspace.CurrentCamera
local RS = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Flashlight = RS.flashlight
local Clone = Flashlight:Clone()
Clone.Parent = script.Parent
local Brightness = 3
local Keybind = Enum.KeyCode.F
local UIS = game:GetService("UserInputService")
local Toggle = false
local Mouse = game.Players.LocalPlayer:GetMouse()
local TS = game:GetService("TweenService")
local TI = TweenInfo.new(.1, Enum.EasingStyle.Sine)
UIS.InputBegan:Connect(function(Input, p)
if p then return end
if Input.KeyCode == Keybind then
Toggle = not Toggle
end
end)
RunService.RenderStepped:Connect(function()
if Clone then
Clone.Position = cam.CFrame.Position
TS:Create(Clone, TI, {CFrame = CFrame.lookAt(Clone.Position, Mouse.Hit.Position)}):Play()
if Toggle then
TS:Create(Clone.SpotLight, TI, {Brightness = Brightness}):Play()
else
TS:Create(Clone.SpotLight, TI, {Brightness = 0}):Play()
end
end
end)
But that doest seem to work, Im new to scripting so please explain as clear as possible