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

why Mouse is nil value in my script??? please answer

this script in serverscriptservice and its not working its an event script

console.script1Beast.OnServerEvent:connect(function(p, Mouse)
	--creation by missingboshjio
--for r6
local a
local b
local c
local d
local e
local f
local g
local h
local version = {"1.0"}

local c = p.Character
local hum = c.Humanoid
local m = Mouse
local t = c.Torso
local hrp = c.HumanoidRootPart
local hed = c.Head
local ril = c["Right Leg"]
local lel = c["Left Leg"]
local ria = c["Right Arm"]
local lea = c["Left Arm"]
local targetI = nil
local intro = true
local death = false

spawn(function()
    while wait() do
        hed.BrickColor = BrickColor.new("Maroon")
        ria.BrickColor = BrickColor.new("Maroon")
        lea.BrickColor = BrickColor.new("Maroon")
        t.BrickColor = BrickColor.new("Maroon")
        ril.BrickColor = BrickColor.new("Maroon")
        lel.BrickColor = BrickColor.new("Maroon")
		local ff = Instance.new("ForceField")
		ff.Parent = t
		wait()
		ff.Parent = hrp
		ff.Visible = false
		local fire = Instance.new("Fire", t)
		fire.Heat = 5
		fire.Size = 5
		fire.Color = Color3.new(117,0,0)
		wait(0.1)
		t.Anchored = true
		local crown = Instance.new("Part", c)
		crown:BreakJoints()
		crown.CanCollide = false
		crown.Name = "crown"
		crown.Transparency = 0.9
		crown.Size = Vector3.new(100,25,100)
		crown.BrickColor = BrickColor.new("Maroon")
		local crownmesh = Instance.new("SpecialMesh", crown)
		crownmesh.Name = "crownmesh"
		crownmesh.MeshId = "http://www.roblox.com/asset/?id=1078075"
		crownmesh.Scale = Vector3.new(100,25,100)
		local crownweld = Instance.new("Weld", crown)
		crownweld.Name = "crownweld"
		crownweld.Part0 = t
		crownweld.Part1 = crown
		wait(0.1)
		crown.Transparency = 0.8
		wait(0.1)
		crown.Transparency = 0.7
		wait(0.1)
		crown.Transparency = 0.6
		wait(0.1)
		crown.Transparency = 0.5
		wait(0.1)
		crown.Transparency = 0.4
		wait(0.1)
		crown.Transparency = 0.3
		wait(0.1)
		crown.Transparency = 0.2
		wait(0.1)
		crown.Transparency = 0.1
		wait(0.1)
		crown.Transparency = 0
		wait(2)
		local ex = Instance.new("Part", c)
		ex:BreakJoints()
		ex.CanCollide = false
		ex.Name = "explosion"
		ex.Transparency = 0
		ex.Size = Vector3.new(1,1,1)
		ex.BrickColor = BrickColor.new("Really red")
		ex.Material = Enum.Material.Neon
		ex.Shape = "Ball"
		local exweld = Instance.new("Weld", crown)
		exweld.Name = "exweld"
		exweld.Part0 = t
		exweld.Part1 = ex
		local explosionsound = Instance.new("Sound", ex)
		explosionsound.SoundId = "rbxassetid://2770705399"
		explosionsound.Volume = 5
		explosionsound.PlaybackSpeed = 0.5
		explosionsound:Play()
		wait(0.5)
		ex.Size = Vector3.new(10,10,10)
		wait(0.5)
		ex.Size = Vector3.new(25,25,25)
		wait(0.5)
		ex.Size = Vector3.new(50,50,50)
		wait(0.5)
		ex.Size = Vector3.new(75,75,75)
		wait(0.5)
		ex.Size = Vector3.new(90,90,90)
		wait(0.5)
		ex.Size = Vector3.new(100,100,100)
		wait(0.5)
		ex:Destroy()
		crown:Destroy()
		
		local sound = Instance.new("Sound", t)
		sound.Name = "lol"
		sound.Looped = true
		sound.SoundId = "rbxassetid://2526061641"
		sound:Play()
		
		while true do
			wait(1)
			t.Anchored = false
			hed.face.Texture = "http://www.roblox.com/asset/?id=328783763"
			hum.WalkSpeed = 25
		end
    end
end)

local txt = Instance.new("BillboardGui", c)
txt.Adornee = hed
txt.Name = "nil2"
txt.Size = UDim2.new(2, 0, 1.2, 0)
txt.StudsOffset = Vector3.new(-7.2, 3.5, 0)
local text = Instance.new("TextLabel", txt)
text.Size = UDim2.new(10, 0, 7, 0)
text.FontSize = "Size12"
text.TextColor3 = Color3.new(117,0,0)
text.TextScaled = false
text.TextTransparency = 0
text.BackgroundTransparency = 1
text.TextTransparency = 0
text.TextStrokeTransparency = 1
text.Font = Enum.Font.GothamBold
text.TextStrokeColor3 = Color3.new(0, 0, 0)
text.Text = "-- Beast"

m.Button1Down:connect(function()
	local hitbox = Instance.new("Part", ria)
	hitbox.Transparency = 1
	hitbox.CFrame = ria.CFrame
	hitbox.Parent = c
	hitbox.Name = "hitbox"
	hitbox.Size = Vector3.new(2,2,2)
	hitbox.CFrame = ria.CFrame
	hitbox:BreakJoints()
	hitbox.CanCollide = false
	hitbox.BrickColor = BrickColor.new("Medium Stone")
	hitbox.TopSurface = "Smooth"
	hitbox.BottomSurface = "Smooth"
	hitboxweld = Instance.new("Weld")
	hitboxweld.Name = " "
	hitboxweld.Part0 = ria

1 comment

0

Follow DRY. TL;DR

2 answers

parameter can't be mouse. you will get nil.

3 comments

0

umm its possible just in localscript is Player:GetMouse() but in normal script what that?????

0

@MissingBoshijo if you want to use Mouse.Button1Down so use local script and then fire the event when mouse down

0

Going along with Nakama_G, I think Mouse gets filtered by Filter Enabled, as well... its not useful to a server event.

you can use anything in the parameter but you can't access Mouse from the normal script, you need to do it on a local script instead

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