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

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

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)

2 comments

0

What is not working? Any error in the output window? What exactly supposed to happen? Post any info you can.

0

the output says nothing

1 answer

✓ Accepted answer
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

1 comment

0

O h makes more sense thank you

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