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

i am trying to make a ball but it wont execute the the script that makes it go how do i fix?

Asked by 5 years ago

the fire events

local plr = game.Players.LocalPlayer
local InputService = game:GetService("UserInputService")

InputService.InputBegan:Connect(function(input)
    local key = input.KeyCode --Gets the key that the player pressed
    if key == Enum.KeyCode.R then --Checks if the key is Q
   game.Workspace.act:FireServer()

    end
end)
local plr = game.Players.LocalPlayer
local InputService = game:GetService("UserInputService")

InputService.InputEnded:Connect(function(input)
    local key = input.KeyCode 
    if key == Enum.KeyCode.R then
       game.Workspace.fer:FireServer()
    end
end)

the script

--this wont work wont execute
game.Workspace.fer.OnServerEvent:Connect(function(plr)
    local we = game.Players.LocalPlayer
    local plr = plr.Character
    local x = plr.Fire
    local wa = game.Players.LocalPlayer.Character:WaitForChild("Fire")
    local b = Instance.new("BodyVelocity",wa)
    local mouse = we:GetMouse()
    b.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
    x.Anchored = false
    b.Velocity = mouse.Hit.LookVector * 34
wa.Parent = workspace

end)
----
--the other script this one works 
local fly = true
game.Workspace.act.OnServerEvent:Connect(function(plr)
    local plr = plr.Character
    local i = Instance.new("Part",plr)

i.Position = plr.UpperTorso.Position
i.Anchored = true
i.BrickColor = BrickColor.new("Dark blue")
i.Shape = "Ball"
i.Material = "Neon"
i.Name = "Fire"
i.CanCollide = false
while fly == true do
    wait(.78)
    i.Size = i.Size + Vector3.new(.4,.4,4) 

end
end)


0
"if key == Enum.KeyCode.R then --Checks if the key is Q" i think you mean if the player pressed R or Q stinkyest11 78 — 5y
0
localplayer does not work on regular scripts stinkyest11 78 — 5y
0
local we = plr or just dont have the variable we stinkyest11 78 — 5y
0
local mouse = plr:GetMouse() local wa = plr:WaitForChild("Fire") stinkyest11 78 — 5y
0
you should the change the plr variable to something else as u have (function(plr) then a variable plr stinkyest11 78 — 5y

1 answer

Log in to vote
0
Answered by
aazkao 787 Moderation Voter
5 years ago
Edited 5 years ago

I jus ttested it and it does execute, make sure your remote events are named correctly and placed in the correct place, also make sure your syntax in the OnServerEvent is correct, like your plr.fire, what is that supposed to be? and plr.uppertorso doesnt exist, its plr.Torso

local plr = game.Players.LocalPlayer
local InputService = game:GetService("UserInputService")

InputService.InputBegan:Connect(function(input)
    local key = input.KeyCode --Gets the key that the player pressed
    if key == Enum.KeyCode.Q then --Checks if the key is Q
   game.Workspace.act:FireServer()
else if key == Enum.KeyCode.R then
   game.Workspace.fer:FireServer()
end

    end
end)

This should work to trigger the event when q and r is pressed

0
uppertorso does exist for r15 but not for r6 User#23365 30 — 5y
0
it dose not work helleric -3 — 5y
0
ah i see, thought he was using R6, anyway i tested the remote events and it did trigger, both the first one and the second one, make sure your spelling of the remote events are correct(case sensitive), and they are under workspace like you wrote in the script, use print statements at the top of the server event listener to double check that it is indeed triggering and not cause your coding iswrong aazkao 787 — 5y
Ad

Answer this question