Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Does anyone know how I can make a flashlight from R6 work the same way in R15? [closed]

Asked by 4 years ago

I'm trying to make a game where the character is standing in a room and cannot move. The game was made in R15 and I realized the flashlights only work properly in R6, as when in R6 you can move your mouse to move the flashlight. I have made many animations in the game for R15 so I do not want to change it to R6. I have tried to edit the script for the flashlight, but nothing I have done has worked so far. Here is the flashlight script.

sp=script.Parent

cooldown=.35

lightontexture=115984370 lightofftexture=115955343

local weld=sp:WaitForChild("Motor") local lp=sp:WaitForChild("LightPart") local handle=sp:WaitForChild("Handle") local spotlight=lp:WaitForChild("SpotLight") local spotlight2=lp:WaitForChild("SpotLight2") local mesh=handle:WaitForChild("Mesh") local sound=handle:WaitForChild("Sound") lastclick=0

sp.Equipped:connect(function(mouse) equipped=true if mouse~=nil then themouse=mouse mouse.Button1Down:connect(function() if lastclick+cooldown<tick() then spotlight.Enabled=not spotlight.Enabled spotlight2.Enabled=spotlight.Enabled mesh.TextureId="http://www.roblox.com/asset?id="..tostring((spotlight.Enabled and lightontexture) or lightofftexture) sound:Play() lastclick=tick() end end) end if weld~=nil then weld.Parent=sp end while equipped and sp.Parent~=nil do local head=sp.Parent:FindFirstChild("Head") if spotlight.Enabled and themouse and handle and weld and head then local vec=themouse.Hit.p-head.Position local pos=(handle.CFrame*CFrame.new(0,0,-1)).p local cf=CFrame.new(pos,pos+vec) weld.C0=handle.CFrame:toObjectSpace(cf) end wait() end end)

sp.Unequipped:connect(function() if weld~=nil then weld.Parent=sp end equipped=false end)

0
use code blocks, please Leamir 3138 — 4y

Closed as Too Broad by JesseSong and Leamir

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?