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

My Paintball Gun only works in Roblox Studio, Not in Roblox Player! What do I Do?

Asked by 8 years ago
Edited 8 years ago

I made a paintball game, but the gun only works in the test mode in Studio, but not in Player... WHAT DO I DOOOO! Thanks for any of the help, the Script is here,

LOCAL SCRIPT `local player = game.Players.LocalPlayer local mouse = player:GetMouse() local tool = script.Parent local handle = tool:WaitForChild("Handle")

PaintColors = {Color3.new(255/255, 0/255, 0/255), Color3.new(0/255, 255/255, 0/255), Color3.new(0/255, 0/255, 255/255)}

RS = player.Character:FindFirstChild("Torso"):FindFirstChild("Right Shoulder")

local enabled = true

tool.Activated:connect(function() if enabled == false then return end enabled = false handle:FindFirstChild("Fire"):Play() local Paint = Instance.new("Part") Paint.Size = Vector3.new(1, 1, 1) Paint.Shape = "Ball" Paint.TopSurface = "Smooth" Paint.BottomSurface = "Smooth" Paint.Color = PaintColors[math.random(1, #PaintColors)] m = Instance.new("SpecialMesh", Paint) m.Scale = Vector3.new(.2, .2, .2) BV = Instance.new("BodyVelocity") BV.velocity = CFrame.new(handle.Position, mouse.Hit.p).lookVector*100 BV.maxForce = Vector3.new(math.huge, math.huge, math.huge) Paint.Parent = workspace BV.Parent = Paint Paint.CFrame = handle.CFrame * CFrame.new(0, 2, 0) local damage = script.Script:clone() damage.Parent = Paint wait(1) enabled = true end)`

That is the first peice of code dirrectly int he Paintball Gun, But there is 1 more Peice of code inside of this peice

SCRIPT `script.Parent.Touched:connect(function(hit)

local char = hit.Parent
local hum = char:FindFirstChild("Humanoid")
if hum ~= nil then
    hum.Health = 0
    script.Death:Play()
end
script.Parent.Anchored = true
script.Parent:FindFirstChild("Mesh").Scale = Vector3.new(0.1, 0.1, 0.1)
F = Instance.new("Fire")
F.Parent = script.Parent
F.Size = 3
F.Color = script.Parent.Color
wait(1)
F.Parent = nil
script.Parent:remove()

end) `

And thats it, it only appears in Roblox Studio Test Mode, Not in Player......

0
Actually, the First one is a Script As Well. Thanks! PartyScripters 20 — 8y

1 answer

Log in to vote
0
Answered by
Bulvyte 388 Moderation Voter
8 years ago
Edited 8 years ago
repeat wait() until game.Players.LocalPlayer.Character
repeat wait() until game.Players.LocalPlayer.Character:IsDescendantOf(game.Workspace)

Put this on the top line, tell me if it works

0
This dosent work, im sorry, i tried it on the fronts of both scripts, then each of them individually, it dident work PartyScripters 20 — 8y
Ad

Answer this question