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

My script works in Studio Test mode, didn't work when I played it. WHY?

I'm using Local Script, my workspace was not FE... The thing is when I click the specific key to active the script, it didn't work. But after I reseted it works sometimes but it( pink ball) launch at where I reset. Sometimes when I reset it didn't work. I put all the script in Starter pack... these scripts use the same base and the original base script didn't work either. Please help. Thank you.

Here are one three scripts for three pink balls
Script 1:

Player = script.Parent.Parent
Character = Player.Character 
Mouse = Player:GetMouse() 
function onKeyDown(key) 
	key = key:lower() 
	if key == "z" then 
		local x = Instance.new("Part") 
		x.TopSurface = "Smooth" 
		x.BottomSurface = "Smooth" 
		x.Shape = "Ball" 
		x.Transparency = 0
		x.BrickColor = BrickColor.new("Hot pink") 
		x.Material = "Neon"
		local f = Instance.new("ParticleEmitter") 
		f.Parent = x
		f.Rate = 1000
		f.Lifetime = NumberRange.new(2,3)
		local color1 = Color3.new(255/255,0/255,191/255)
		local color2 = Color3.new(255/255,152/255,220/255)
		f.Color = ColorSequence.new(color1,color2)
		local y = Instance.new("BodyVelocity") 
		y.maxForce = Vector3.new(math.huge, math.huge, math.huge)
		y.velocity = Character.Torso.CFrame.lookVector*80
		y.Parent = x  
		x.Parent = Workspace 
		x.CFrame = Character.Torso.CFrame*CFrame.new(0, 0, -12)
  
	end 
end 
Mouse.KeyDown:connect(onKeyDown)

1 comment

0

At the start add a wait(5)

1 answer

Trying to access anything server-side with a local script will not work. Try using a regular script instead.

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