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

I tried making a tool that summons a model why doesn't it work?

Asked by 5 years ago

Here is my code for the local script

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local input = game:GetService("UserInputService")
input.InputBegan:Connect(function(key, gameProcessed)
    if gameProcessed then
    if  key == Enum.KeyCode.E   then
        print("?")
        game.ReplicatedStorage.ItemEvents.Blast:FireServer("e", mouse.Hit)
    end
    end
end)

Here is my script

local Attack = require(script.Parent.Attacks)
game.ReplicatedStorage.ItemEvents.Blast.OnServerEvent:Connect(function(plr,Key,Mouse)
        local Blaster = game.ServerStorage.Blaster:Clone()
    print("Blast")
    Blaster.Name = "BlastClone"
    Blaster.Parent = game.Workspace

Blaster:MoveTo(script.Parent.Parent.Head.Position)


    local lookTo = CFrame.Angles(Mouse.Position.X,Mouse.Position.Y,Mouse.Position.Z)

    Blaster:SetPrimaryPartCFrame(CFrame.new(script.Parent.Head.CFrame.X,script.Parent.Head.CFrame.Y,script.Parent.Head.CFrame.Z) * lookTo)

    wait(7.9999)
    Blaster:Remove()
end)
0
What is not working? Any error in the output window? What exactly supposed to happen? Post any info you can. Azure_Kite 885 — 5y
0
the output says nothing 1TheLeaf 2 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
if  key == Enum.KeyCode.E   then

Thats the fault, you need to get the keycode of "key" So it should be

if  key.KeyCode == Enum.KeyCode.E   then
0
O h makes more sense thank you 1TheLeaf 2 — 5y
Ad

Answer this question